<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
	
	<script src="${ctx}/js/controllers/coupon/CouponInfoListController.js" type="text/javascript"></script>
	
	<script type="text/javascript">
		var ctx = '${ctx}';
		setCtx(ctx);
	</script>
	 <div style="top:130px;position:fixed;height:30px;font-size: 14px;font-family: '微软雅黑';margin-left:-236px;">
				当前位置：${sessionScope.currcent_position}
          </div>
           <section>
              <section>
                <!--begin 搜索栏 -->
                <input id="selectedS" type="hidden" value="${selectState }"/>
                <div class="panel" style="margin-top:23px;">
                	
					<div style="float:left;height: 31px;width:100px;margin-left:10px;position:relative;position:relative;overflow:hidden;color:#808080;font:14px;">
						
								<input type="hidden" value="0"/>
								<img id="selected1" class="pic-y"src="${ctx}/images/seller/coupon/select_blue.png" style="margin-right:15px;margin-top:-4px;cursor: pointer;" onclick="searchByTime(this)">
								<a onclick="searchByTime(this)" style="color:#808080;font-size: 14px;">所有</a>
								<img class="pic-cur"style="position:absolute;bottom:0px;left:0px;visibility:visible;"class="current-pic" src="${ctx}/images/seller/coupon/currpic.png" >
							
					</div>
					
					<div style="float:left;height: 31px;width:100px;margin-left:10px;color:#808080;font:14px;position:relative;">
					  	<input type="hidden" value="1"/>
						<img id="selected2"class="pic-y" src="${ctx}/images/seller/coupon/select_blue.png" style="margin-right:15px;margin-top:-4px;cursor: pointer;" onclick="searchByTime(this)">
						<a onclick="searchByTime(this)" style="color:#808080;font-size: 14px;">未开始</a>
						<img class="pic-cur" style="position:absolute;bottom:0px;left:0px;visibility:hidden"class="current-pic" src="${ctx}/images/seller/coupon/currpic.png" >
					</div>
		            <div style="float:left;height: 31px;width:100px;margin-left:10px;color:#808080;font:14px;position:relative;">
		             <input type="hidden" value="2"/>
		            <img id="selected3" class="pic-y"src="${ctx}/images/seller/coupon/select_blue.png" style="margin-right:15px;margin-top:-4px;cursor: pointer;" onclick="searchByTime(this)">
		            <a onclick="searchByTime(this)" style="color:#808080;font-size: 14px;">进行中</a>
		            <img class="pic-cur" style="position:absolute;bottom:0px;left:0px;visibility:hidden"class="current-pic" src="${ctx}/images/seller/coupon/currpic.png" >
		            </div>
		            <div style="float:left;height: 31px;width:100px;margin-left:10px;color:#808080;font:14px;position:relative;">
		              <input type="hidden" value="3"/>
		            <img id="selected4" class="pic-y" src="${ctx}/images/seller/coupon/select_blue.png" style="margin-right:15px;margin-top:-4px;cursor: pointer;" onclick="searchByTime(this)">
		            <a onclick="searchByTime(this)" style="color:#808080;font-size: 14px;">已结束</a>
		            <img class="pic-cur" style="position:absolute;bottom:0px;left:0px;visibility:hidden"class="current-pic" src="${ctx}/images/seller/coupon/currpic.png" >
		            </div>
		         
                </div><!--end 搜索栏 -->	
                <!--begin table表格 -->
                <div>
               
                <table class="table" style="margin-top:0">
                    <thead>
                      <tr>
                       <th width="5%">序号</th>
                        <th width="10%" style="border-left: #e6e6e6 1px solid;">名称</th>
                        <!-- <th width="8%">优惠券类型</th> -->
                        <th width="12%">价值</th>
                        <!-- <th width="7%">减免金额</th> -->
                        <th width="10%">领取有效期</th>
                        <th width="10%">使用有效期</th>
                        <th width="7%">状态</th>
                        <!-- <th width="8%">结束时间</th> -->
                        <th width="12%">使用量/领取量/总量</th>
                        <!-- <th width="7%">有效天数</th> -->
                        <th width="14%">操作</th>
                      </tr>
                    </thead>
                    <tbody id="tableTbody">
                      	<c:forEach items="${couponInfo.list }" var="couponInfo" varStatus="couponInfoStatus">
	                      <tr>
	                      <td>${couponInfoStatus.index + 1 }</td>
	                        <td>${couponInfo.name}</td>
	                       <%--  <td>
	                        <c:choose>
	                        <c:when test="${couponInfo.type == 1}">平台新人券</c:when>
	                        <c:when test="${couponInfo.type == 2}">平台邀请券</c:when> 
	                        <c:when test="${couponInfo.type == 3}">满减券</c:when>
	                        <c:when test="${couponInfo.type == 4}">商家免运费券</c:when>
	                        <c:otherwise> </c:otherwise>
	                        </c:choose></td> --%>
	                        <%-- <td>${couponInfo.cellName}</td>
	                        <td>${couponInfo.shopName}</td> --%>
	                        <td>￥${couponInfo.breakLine}<br/>最低消费： ￥${couponInfo.breakPrice}</td>
	                        <td>&nbsp;&nbsp;${couponInfo.beginDate}至<br/>${couponInfo.endDate}&nbsp;&nbsp;</td>
	                        <td>&nbsp;&nbsp;${couponInfo.useBeginDate}至<br/>${couponInfo.useEndDate}&nbsp;&nbsp;</td>
	                        <td ><c:choose>
	                        <c:when test="${couponInfo.state == 2}">正常</c:when>
	                        <c:when test="${couponInfo.state == 3 || couponInfo.state == 5}">禁用</c:when>
	                        <c:otherwise> </c:otherwise>
	                        </c:choose></td>
	                        <td>${couponInfo.useNumber}&nbsp;/&nbsp;${couponInfo.countNumber}&nbsp;/&nbsp;${couponInfo.count}</td>
	                        <%-- <td>${couponInfo.availableDay}</td> --%>
	                        <td >
	                           <c:if test="${couponInfo.state == 2}">
	              	            <a onclick="approved(${couponInfo.id},${couponInfo.state})">
								<img src="${ctx}/images/seller/coupon/forbidden.png">&nbsp;&nbsp;禁用</a>
	                          </c:if>
	                          <c:if test="${couponInfo.state == 5}">
	                          	<a onclick="approved(${couponInfo.id},${couponInfo.state})">
								<img src="${ctx}/images/seller/coupon/qiyong.png">&nbsp;&nbsp;启用</a>
	                          </c:if>
	                          <c:if test="${couponInfo.state == 3}">
	                          	<a onclick="noPower(${couponInfo.state})">
								<img src="${ctx}/images/seller/coupon/qiyong.png">&nbsp;&nbsp;启用</a>
	                          </c:if>
	                        <a class="fa fa-check " onclick="exportExcel(${couponInfo.id},${couponInfo.countNumber});">
	                        <img src="${ctx}/images/seller/coupon/export.png" style="margin-left:32px;">&nbsp;&nbsp;导出</a>
	                        </td>
	                      </tr>
                      	</c:forEach>
                    </tbody>               
                                      
                    <tfoot>
		            	<tr>
			               <td colspan="8">
			                  <div>
			                   <%--  <div style="float:left;">
			                      <span class="total">合计 ${couponInfo.total} 条数据</span>               
			                    </div>  --%>
			                    <div style="float:right;  margin-right: 10px;margin-top: 29px"> 
				                  <div style="float:left;">                 
				                      <ul class="footer_ul">
				                      	<c:if test="${couponInfo.hasPreviousPage }">
				                        <li onclick="gotoPage(${currentPage-1 });"><a style="color:#37CED4">&lt;&lt;</a></li>
				                      	</c:if>
				                        <c:if test="${couponInfo.firstPage > 1}">
				                        	<li onclick="gotoPage(1);" style="border: 1px solid #9A9A9A;">
				                             	<a>1</a>
				                        	</li>
				                        	<c:if test="${couponInfo.firstPage > 2}">
				                        		...
				                        	</c:if>
				                      	</c:if>
				                        <c:forEach items="${couponInfo.navigatepageNums }" var="page">
				                        <li onclick="gotoPage(${page });" class="<c:if test="${currentPage == page }">active</c:if>" style="border: 1px solid #9A9A9A;">
				                             <a>${page}</a>
				                        </li>
				                        </c:forEach>
				                        <c:if test="${couponInfo.lastPage < couponInfo.pages}">
				                        	<c:if test="${couponInfo.firstPage < couponInfo.pages - 1}">
				                        		...
				                        	</c:if>
				                        	<li onclick="gotoPage(${couponInfo.pages});" style="border: 1px solid #9A9A9A;">
				                             	<a>${couponInfo.pages}</a>
				                        	</li>
				                      	</c:if>
				                        <c:if test="${couponInfo.hasNextPage }">
				                        <li><a onclick="gotoPage(${currentPage+1});" style="color:#37CED4">&gt;&gt;</a></li>
				                      	</c:if>
				                      </ul>
			                     </div>
		                   		<div style="float:left;  height: 30px;">
									<span style="color: #9A9A9A;">跳转到</span> 
									<input class="inputclass" id="pageNo" onkeydown="if(event.keyCode==13){event.keyCode=0;return false;}" 
									type="text" value="${currentPage }" style="width:26px;height:28px" onkeyup = "checInputNum(this)">
									<span style="color: #9A9A9A;">页</span> 
									<span class="buttonclass" id="J_JumpTo" onclick="gotoCouponInfoPage(null);"><a>GO</a></span>
								</div>
			                 </div>
			                 </div>
							</td>
						</tr>
					</tfoot>
                  </table>
                  
                </div>
              </section>
            </section>
<script type="text/javascript">
$(function(){
	var selectedS = $("#selectedS").val();
	if(selectedS == 0){
		$("#selected1").attr("src","${ctx}/images/seller/coupon/select_yellow.png");
		$("#selected1").parent().siblings().children(".pic-y").attr("src","${ctx}/images/seller/coupon/select_blue.png");
		$("#selected1").parent().children(".pic-cur").css("visibility","visible");
		$("#selected1").parent().siblings().children(".pic-cur").css("visibility","hidden");
	}
	if(selectedS == 1){
		$("#selected2").attr("src","${ctx}/images/seller/coupon/select_yellow.png");
		$("#selected2").parent().siblings().children(".pic-y").attr("src","${ctx}/images/seller/coupon/select_blue.png");
		$("#selected2").parent().children(".pic-cur").css("visibility","visible");
		$("#selected2").parent().siblings().children(".pic-cur").css("visibility","hidden");
	}
	if(selectedS == 2){
		$("#selected3").attr("src","${ctx}/images/seller/coupon/select_yellow.png");
		$("#selected3").parent().siblings().children(".pic-y").attr("src","${ctx}/images/seller/coupon/select_blue.png");
		$("#selected3").parent().children(".pic-cur").css("visibility","visible");
		$("#selected3").parent().siblings().children(".pic-cur").css("visibility","hidden");
	}
	if(selectedS == 3){
		$("#selected4").attr("src","${ctx}/images/seller/coupon/select_yellow.png");
		$("#selected4").parent().siblings().children(".pic-y").attr("src","${ctx}/images/seller/coupon/select_blue.png");
		$("#selected4").parent().children(".pic-cur").css("visibility","visible");
		$("#selected4").parent().siblings().children(".pic-cur").css("visibility","hidden");
	}
})
function searchByTime(target){
	var selectState = $(target).parent().children("input").val();
	//alert(selectState);
	$(target).attr("src","${ctx}/images/seller/coupon/select_yellow.png");
	$(target).parent().siblings().children("img").attr("src","${ctx}/images/seller/coupon/select_blue.png");
	loadContent("/coupon/couponInfoList?pNo=1&selectState="+ selectState );
}



</script>
<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>